<template>
  <div id="header-nav">
    <p class="back" v-show="isBack" @click="goBackTo"><icon name="back" :scale="2"></icon></p>
    <span v-show="!bottomNavIsShow" @click="goBackTo()"><icon name="icon-action-back" :scale="2"></icon></span>
    <p class="title"> {{ activeNavTitle }} </p>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import store from '../store/index'
export default {
  name: 'TopNav',
  methods : {
    goBackTo(){
      //回退一页
      history.go(-1);
    },
  },
  props: {
    isBack: {
      default: false
    }
  },
  computed: {
    ...mapGetters([
      'activeNavTitle',
      'bottomNavIsShow',
    ])
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
#header-nav {
  width:100%;
  height: 44px;
  background-color: #001c2d;
  box-shadow: inset 0 0 1px #575f69;
  position: fixed;
  top: 0;
  z-index: 2;
  overflow: hidden;
}
.back {
  position: absolute;
  left: 10px;
  top: 0;
}
#header-nav span{
  position: absolute;
  color: #fff;
  height: 20px;
  bottom: 0;
  top: 0;
  margin: auto;
  padding-left: 15px;
}
#header-nav p {
  text-align: center;
  line-height: 44px;
  font-size: 18px;
  color: #fff;
}
</style>
